package model.carrerasYPlanes;

import java.util.HashMap;
import java.util.List;

import model.materiasYCatedras.MateriaPorPlanDeEstudio;

public class OrdenOrientativo {
	
	private PlanDeEstudio plan;
	private HashMap<Integer, Nivel> niveles;
	
	public OrdenOrientativo(PlanDeEstudio plan){
		super();
		this.plan = plan;
		this.niveles = new HashMap<Integer, Nivel>();
	}
	
	public void agregarMateria(Integer nivel, MateriaPorPlanDeEstudio materia){
		Nivel level;
		if(this.niveles.containsKey(nivel)){
			level = this.niveles.get(nivel);
		}else{
			level = new Nivel();
			this.niveles.put(nivel, level);
		}
		level.agregarMateria(materia);
	}
	
	public List<MateriaPorPlanDeEstudio> getMateriasDelNivel(Integer nivel){
		if(this.niveles.containsKey(nivel)){
			return this.niveles.get(nivel).getMaterias();
		}else{
			throw new RuntimeException("No existe el nivel en el orden orientativo");
		}
	}

	//********************
	// GETTERS Y SETTERS
	//********************
	
	public PlanDeEstudio getPlan() {
		return plan;
	}

	public void setPlan(PlanDeEstudio plan) {
		this.plan = plan;
	}
}
